﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls" 
    x:Class="NASA.BeAMartian.Views.ViewImage"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">
	<phone:PhoneApplicationPage.Resources>
		<Storyboard x:Name="sbFadeIn">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="stackPanel">
				<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Style x:Key="emptyPivot" TargetType="controls:Pivot">
			<Setter Property="Margin" Value="0"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="ItemsPanel">
				<Setter.Value>
					<ItemsPanelTemplate>
						<Grid/>
					</ItemsPanelTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="controls:Pivot">
						<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" />
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</phone:PhoneApplicationPage.Resources>

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
 
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar BackgroundColor="#FFB67500" IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBar.MenuItems>
            	<shell:ApplicationBarMenuItem Text="Mars Top Ten" x:Name="abMarsTopTen" Click="abMarsTopTen_Click" />
            	<shell:ApplicationBarMenuItem Text="mars as art"  x:Name="abMarsAsArt" Click="abMarsAsArt_Click" />
            	<shell:ApplicationBarMenuItem Text="be a martian home"  x:Name="abBeAMHome" Click="abBeAMHome_Click"/>
            </shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarIconButton IconUri="/icons/zoom_out.png" Text="zoom out" IsEnabled="False"
                   x:Name="abZoomOut" Click="abZoomOut_Click" />
            <shell:ApplicationBarIconButton IconUri="/icons/zoom_in.png" Text="zoom in" 
                   x:Name="abZoomIn" Click="abZoomIn_Click" />
            <shell:ApplicationBarIconButton IconUri="/icons/appbar.back.rest.png" Text="previous" 
                   x:Name="abPrevious" Click="abPrevious_Click" />
            <shell:ApplicationBarIconButton IconUri="/icons/appbar.next.rest.png" Text="next"
                   x:Name="abNext" Click="abNext_Click" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">   
    	<Image Margin="0,0,0,-72" Source="/NASA.BeAMartian;component/Assets/Images/blk.png" Stretch="Fill"/>   
    	<controls:Pivot x:Name="pvtPhotos" Style="{StaticResource emptyPivot}" SelectionChanged="pvtPhotos_SelectionChanged">
    		<controls:Pivot.ItemTemplate>
    			<DataTemplate>
    			   <Grid>
    			   		<ProgressBar x:Name="pbLoading" IsIndeterminate="True" Height="17" Margin="-16,169,-15,0" VerticalAlignment="Top" Background="{StaticResource BeAMAccentBrush}" Foreground="{StaticResource BeAMAccentBrush}"/>
                        <StackPanel Opacity="0" HorizontalAlignment="Left" Margin="0" Orientation="Vertical" VerticalAlignment="Top">
                            <Image x:Name="imgPhoto" Source="{Binding ImageURL}" Margin="0" HorizontalAlignment="Center" Tag="{Binding Title}"
                                   ImageOpened="imgPhoto_ImageOpened" ImageFailed="imgPhoto_ImageFailed" MaxWidth="480" MaxHeight="480"/>
				    		<ScrollViewer HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" >
				    			<StackPanel x:Name="stackPanel" Orientation="Vertical" Margin="10,0,0,0">
				    				<TextBlock x:Name="tbTitle" Text="{Binding Title}" Style="{StaticResource PhoneTextTitle2Style}" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,12,0,0"/>
				    				<StackPanel x:Name="spSpacecraft" Orientation="Horizontal" Visibility="Collapsed">
				    					<TextBlock x:Name="tbSpacecraftLabel" TextWrapping="Wrap" Text="Spacecraft:" Foreground="{StaticResource BeAMAccentBrush}"/>
                                        <TextBlock x:Name="tbSpacecraft" Text="{Binding Spacecraft}" Loaded="tb_Loaded" TextWrapping="Wrap" Margin="8,0,0,0"/>
				    				</StackPanel>
				    				<StackPanel x:Name="spAcquired" HorizontalAlignment="Left" Orientation="Horizontal" Visibility="Collapsed">
				    					<TextBlock x:Name="tbAcquiredLabel" TextWrapping="Wrap" Text="Image Acquired:" Foreground="{StaticResource BeAMAccentBrush}"/>
                                        <TextBlock x:Name="tbAcquired" Text="{Binding Acquired}" Loaded="tb_Loaded" TextWrapping="Wrap" Margin="8,0,0,0"/>
				    				</StackPanel>
				    				<StackPanel x:Name="spLocation" Orientation="Horizontal" Visibility="Collapsed">
				    					<TextBlock x:Name="tbLocationLabel" TextWrapping="Wrap" Text="Location:" Foreground="{StaticResource BeAMAccentBrush}"/>
                                        <TextBlock x:Name="tbLocation" Text="{Binding Location}" Loaded="tb_Loaded" TextWrapping="Wrap" Margin="8,0,0,0"/>
				    				</StackPanel>
				    				<StackPanel x:Name="spComments" Visibility="Collapsed" Margin="0,0,0,100">
				    					<TextBlock x:Name="tbCommentsLabel" TextWrapping="Wrap" Text="Caption:" Foreground="{StaticResource BeAMAccentBrush}"/>
                                        <TextBlock Tag="{Binding Comments}" Loaded="tbComments_Loaded" x:Name="tbComments" TextWrapping="Wrap" 
                                                   Margin="0,-27,0,0" />
				    				</StackPanel>
				    			</StackPanel>
				    		</ScrollViewer>
				    	</StackPanel>   
				   </Grid>		
				</DataTemplate>
			</controls:Pivot.ItemTemplate>
    	</controls:Pivot>
    	<Image x:Name="imgPortrait" Visibility="Collapsed"/>
    	<Image x:Name="imgLandscape" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None" Margin="-110,0" Visibility="Collapsed">
    		<Image.RenderTransform>
    			<CompositeTransform Rotation="90"/>
    		</Image.RenderTransform>
    	</Image>
    </Grid>

</phone:PhoneApplicationPage>
